module StateHandler

  @states = {}
  puts @states.class

  def add_state(state_name, &block)
    puts "#{state_name} added"
    @states = {} unless @states
    @states[state_name] = block
  end

  def call_state(data)
    #begin
      @states[@current_state].call data.sanitize
    #rescue => err
    #  @connection.send_line "i'm afraid i can't let you do that dave"
    #end
  end

  def set_state(state_name)
    puts "now in #{state_name}"
    @current_state = state_name
  end

end
